@extends('layouts.admin.application')

@section('css')
    <link rel="stylesheet" href="/ace/assets/css/datepicker.css">
@endsection

@section('content')
    <div class="main-content">
        <div class="col-xs-12">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li><i class="icon-home home-icon"></i><a href="#">首页</a></li>
                    <li><a href="{{ route('cashier.member.index') }}">会员管理</a></li>
                    <li class="active">编辑会员信息</li>
                </ul>
            </div>

            @include('layouts.partials._flash')

            <form class="form-horizontal" role="form" action="{{ route('cashier.member.update', $member->id) }}"
                  method="post"
                  style="margin-top: 20px;">

                {{csrf_field()}}

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">姓名：</label>

                    <div class="col-sm-9">
                        <input type="text" name="name" value="{{$member->name}}" placeholder="会员名称，你懂得~"
                               class="col-xs-10 col-sm-5">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">性别：</label>

                    <div class="col-sm-9">
                        <div class="radio" style="">
                            <label>
                                <input name="sex" type="radio" class="ace" value="1" @if($member->sex) checked @endif>
                                <span class="lbl"> 男</span>
                            </label> &nbsp;&nbsp;&nbsp;&nbsp;
                            <label>
                                <input name="sex" type="radio" class="ace" value="0" @if(!$member->sex) checked @endif>
                                <span class="lbl"> 女</span>
                            </label>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">手机号码：</label>

                    <div class="col-sm-9">
                        <input type="text" name="phone" value="{{$member->phone}}" class="col-xs-10 col-sm-5">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">生日：</label>

                    <div class="col-sm-9">
                        <div class="input-group" style="width: 358px;">
                            <input class="form-control datepicker" type="text" name="birthday" value="{{$member->birthday}}"/>
                            <span class="input-group-addon"><i class="icon-calendar bigger-110"></i></span>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">经办人：</label>

                    <div class="col-sm-9">
                        <input type="text" name="manager" value="{{$member->manager}}" class="col-xs-10 col-sm-5">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">所属门店</label>

                    <div class="col-sm-9">
                        <select class="col-xs-10 col-sm-5" name="store_id">
                            <option value="0">请选择</option>
                            @foreach($stores as $store)
                                <option value="{{$store->id}}" @if($store->id == $member->store_id) selected @endif>
                                    {{$store->name}}</option>
                            @endforeach
                        </select>
                    </div>
                </div>

                <div class="clearfix form-actions">
                    <div class="col-md-offset-3 col-md-9">
                        <button class="btn btn-info" type="submit"><i class="icon-ok bigger-110"></i>保存</button>
                        &nbsp; &nbsp; &nbsp;
                        <a class="btn" onclick="javascript:history.back(-1);return false;">
                            <i class="icon-undo bigger-110"></i>返回</a>
                    </div>
                </div>
            </form>
        </div>
    </div>
@endsection

@section('js')
    <script src="/ace/assets/js/date-time/bootstrap-datepicker.min.js"></script>
    <script src="/ace/assets/js/date-time/bootstrap-datepicker.zh-CN.js"></script>
    <script src="/ace/assets/js/date-time/moment.min.js"></script>
    <script>
        $(function () {
            $('.datepicker').datepicker({
                format: 'yyyymmdd',
                language: 'zh-CN'
            });
        })
    </script>
@endsection
